@echo off

set output=PlayKrn.elf

set armdir=c:\arm
set sdkdir=..\sdk
set lib_o=..\Lib.o
rem  -DDEBUG -DDEBUG_MEMORY -DDEBUG_TIME
rem  -DFTR_L7E
set options=-DDEBUG -DDEBUG_MEMORY

if exist %output% del %output%



set src_input=kernel.c

%armdir%\tcc -I"%sdkdir%" -c -bigend -O2 -apcs /interwork %options% %src_input%

set tmp_o=kernel.o
set ext_o=..\dbg\dbg.o ..\libs\libc.o

echo =======================================

%armdir%\armlink -reloc -first Lib.o(Lib) -o %output% %tmp_o% %ext_o% %lib_o%




del %tmp_o%

if exist %output% (
	echo ACK: File `%output%` created
) else (
	echo ERR: File `%output%` not created
)
echo =======================================

goto make_gui_cover
rem --------------------------------------------------
rem Skip PlayCtrl_test

set output=PlayCtrl_test.elf
if exist %output% del %output%
set src_input=test_ctrl.cpp

%armdir%\tcpp -I"%sdkdir%" -c -bigend -O2 -apcs /interwork %options% %src_input%

set tmp_o=test_ctrl.o
echo =======================================

%armdir%\armlink -reloc -first Lib.o(Lib) -o %output% %tmp_o% %ext_o% %lib_o%




del %tmp_o%

if exist %output% (
	echo ACK: File `%output%` created
) else (
	echo ERR: File `%output%` not created
)
echo =======================================

rem ---------------------------------------------------

:make_gui_cover

set output=PlayCover.elf
if exist %output% del %output%
set src_input=cover.cpp

%armdir%\tcpp -W -I"%sdkdir%" -c -bigend -O2 -apcs /interwork %options% %src_input%
%armdir%\tcc -W -I"%sdkdir%" -c -bigend -O2 -apcs /interwork %options% font.c

set tmp_o=cover.o font.o
echo =======================================

%armdir%\armlink -reloc -first Lib.o(Lib) -o %output% %tmp_o% %ext_o% %lib_o%




del %tmp_o%

if exist %output% (
	echo ACK: File `%output%` created
) else (
	echo ERR: File `%output%` not created
)
echo =======================================
